home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / WebObjects / WebObjectsDoc_HTML / Reuse / ReusableComponentsEx / ObjectEditor.wo / ObjectEditor.wos < prev   
Encoding:
Text File  |  1996-02-29  |  1.2 KB  |  73 lines

  1. ////////////////////////
  2. //  ObjectEditor
  3. //  by Charles Lloyd
  4. ////////////////////////
  5.  
  6. ///////////////////
  7. //    User Options
  8. ///////////////////
  9. id labelArray;
  10. id keyArray;
  11. id targetObject;
  12.  
  13. id borderSize;
  14. id cellPadding;
  15. id cellSpacing;
  16. id fieldSize;
  17. id isEditable;
  18.  
  19. ////////////////////
  20. //  Internal State
  21. ////////////////////
  22. id valueArray;
  23. id valueDictionary;
  24.  
  25. id entryCount;
  26. id rowIndex;
  27.  
  28. id labelString;
  29. id valueString;
  30.  
  31.  
  32. - awake
  33. {
  34.     borderSize = 1;
  35.     cellSpacing = 0;
  36.     cellPadding = 0;
  37.     fieldSize = 15;
  38.     rowIndex = 0;
  39.     isEditable = NO;
  40. }
  41.  
  42. - setLabelArray:anArray
  43. {
  44.     labelArray = anArray;
  45.     entryCount = [labelArray count];
  46. }
  47.  
  48. - labelString
  49. {
  50.     return [labelArray objectAtIndex:rowIndex];
  51. }
  52.  
  53. - valueString
  54. {
  55.     id aKey = [keyArray objectAtIndex:rowIndex];
  56.     id aDict = [targetObject valuesForKeys:keyArray];
  57.     id aValue = [aDict objectForKey:aKey];
  58.     return aValue;
  59. }
  60.  
  61. - setValueString:aValue
  62. {
  63.     id aDict;
  64.     id aKey;
  65.     if (!aValue) {
  66.         return nil;
  67.     }
  68.     aDict = [NSMutableDictionary dictionary];
  69.     aKey = [keyArray objectAtIndex:rowIndex];
  70.     [aDict setObject:aValue forKey:aKey];
  71.     [targetObject takeValuesFromDictionary:aDict];
  72. }
  73.